RDBMS SOLUTION


ASSIGNMENT 4 

SET A Q. 3 SOLUTION

Write a function which will return total maturity amount of policies of a particular client.




Source code:

    

    /*set a q 3 solution

    here we will do same as we have done in the last solution

    we will use count() aggregate function and count total number of policies

    */

    

/*function*/

create or replace function pol

return number is totrec number;

begin

select count(pdate) into totrec from policy_info where pdate='01/01/2020';

return totrec;

end;

/*Execution section*/

declare 

total number;

begin

total:=pol();

dbms_output.put_line('total policies opened on 01/01/2020 is:  '||total);

end;

   

    
 Download code         next